<%-- 
    Document   : news
    Created on : Aug 11, 2014, 6:18:17 AM
    Author     : THAONV
--%>

<%@page import="model.dao.NewsDAO"%>
<%@page import="model.entities.News"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <body>
        <section id="services">
            <div class="container">
                <div class="center gap">
                    <%
                        List<News> news = new ArrayList<News>();
                        NewsDAO newsdao = new NewsDAO();
                        News newss = new News();
                        news = newsdao.getAllNews();
                        int size = news.size();
                    %>

                    <h3>News</h3>
                    <p class="lead">Some news about technology</p>
                </div>


                <div class="row-fluid"> 
                    <% if (size == 6) {
                            newss = news.get(5);
                    %>
                    <div class="span4">
                        <div class="media">
                            <div class="pull-left">
                                <i class="icon-globe icon-medium"></i>
                            </div>
                            <div class="media-body">
                                <h4 class="media-heading"><%= newss.getTitle()%></h4>
                                <p><%= newss.getSumary()%></p>
                            </div>
                        </div>
                    </div> 
                    <% }%>

                    <% if (size >= 5) {
                            newss = news.get(4);
                    %>
                    <div class="span4">
                        <div class="media">
                            <div class="pull-left">
                                <i class="icon-thumbs-up-alt icon-medium"></i>
                            </div>
                            <div class="media-body">
                                <h4 class="media-heading"><%= newss.getTitle()%></h4>
                                <p><%= newss.getSumary()%></p>
                            </div>
                        </div>
                    </div>            
                    <% }%>

                    <% if (size >= 4) {
                            newss = news.get(3);
                    %>
                    <div class="span4">
                        <div class="media">
                            <div class="pull-left">
                                <i class="icon-leaf icon-medium icon-rounded"></i>
                            </div>
                            <div class="media-body">
                                <h4 class="media-heading"><%= newss.getTitle()%></h4>
                                <p><%= newss.getSumary()%></p>
                            </div>
                        </div>
                    </div>
                    <% }%>
                </div>

                <div class="gap"></div>

                <div class="row-fluid">
                    <% if (size >= 3) {
                            newss = news.get(2);
                    %>
                    <div class="span4">
                        <div class="media">
                            <div class="pull-left">
                                <i class="icon-shopping-cart icon-medium"></i>
                            </div>
                            <div class="media-body">
                                <h4 class="media-heading"><%= newss.getTitle()%></h4>
                                <p><%= newss.getSumary()%></p>
                            </div>
                        </div>
                    </div>   
                    <% }%>

                    <% if (size >= 2) {
                            newss = news.get(1);
                    %>
                    <div class="span4">
                        <div class="media">
                            <div class="pull-left">
                                <i class="icon-globe icon-medium"></i>
                            </div>
                            <div class="media-body">
                                <h4 class="media-heading"><%= newss.getTitle()%></h4>
                                <p><%= newss.getSumary()%></p>
                            </div>
                        </div>
                    </div>
                    <% }%>

                    <% if (size >= 1) {
                            newss = news.get(0);
                    %>
                    <div class="span4">
                        <div class="media">
                            <div class="pull-left">
                                <i class="icon-globe icon-medium"></i>
                            </div>
                            <div class="media-body">
                                <h4 class="media-heading"><%= newss.getTitle()%></h4>
                                <p><%= newss.getSumary()%></p>
                            </div>
                        </div>
                    </div>
                    <% }%>
                </div>

            </div>
        </section>
    </body>
</html>
